package com.baic.ibase.models.dao;

import com.alibaba.fastjson2.JSONObject;
import com.baic.ibase.mapper.typeHandler.JsonObjectTypeHandler;
import com.baic.ibase.models.req.devices.CommandType;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.springframework.data.annotation.Id;

import java.io.Serializable;


@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "device_message_log", autoResultMap = true)
public class DeviceMessageLog extends CommonModel implements Serializable {

    @Id
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 设备ID
     */
    private Long deviceId;

    /**
     * 请求ID
     */
    private String requestId;

    /**
     * 设备名称
     */
    private String deviceName;

    /**
     * client_id
     */
    private String deviceClientId;

    /**
     * 命令
     */
    private CommandType deviceCommand;

    /**
     * 命令参数
     */
    @TableField(typeHandler = Fastjson2TypeHandler.class, value = "device_command_param")
    private JSONObject deviceCommandParam;

    /**
     * 响应结果
     */
    @TableField(typeHandler = Fastjson2TypeHandler.class, value = "device_command_response")
    private JSONObject deviceCommandResponse;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 命令执行结果
     */
    private String status;

}
